package API.Collections;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class sort {
    public static void main(String[] args) {
        ArrayList<Integer> list1 = new ArrayList<>();
        for (int i = 10; i > 0; i--) {
            list1.add(i);
        }
        Collections.sort(list1);
        for (Integer i : list1) {
            System.out.print(i + " ");
        }
        System.out.println();
        ArrayList<Integer> list2 = new ArrayList<>();
        for (int i = 1; i <= 10; i++) {
            list2.add(i);
        }
        Collections.sort(list2, (a, b) -> {
            return b - a;
        });
        for (Integer i : list2) {
            System.out.print(i + " ");
        }
    }
}
